#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <time.h>
void Print(void)
{
	printf("******************\n");
	printf("1 is play and 0 is over\n");
	printf("choose 1 or 0\n");
	printf("******************\n");
}
void Game(void)
{
	srand((unsigned int)time(NULL));
	int ret = rand() % (400 - 200 + 1) + 200;
	int flag = 1;//
	int input = 0;
	int count =  5;
	printf("ret=%d\n", ret);
	while (flag == 1&&count != 0)
	{
		printf("please guess and input a num:");
		scanf("%d", &input);
		count--;
		printf("%d chance\n", count);
		if (input == ret)
		{
			printf("success\n");
			flag = 0;
		}
		else if (input > ret)
			printf("too big\n");
		else
			printf("too small\n");
		if (count == 0)
			printf("lose");
	}
}
int main()
{

	Print();
	int input = 0;
	do
	{
		printf("input a num here:");
		scanf("%d", &input);
		switch (input)
		{
		case 1: Game(); break;
		case 0: break;
		}
		if (input == 1)
			printf("play again?\n");
	} while (input != 0);
		
	
	

	return 0;
}